package com.itheima.mvc;

import com.itheima.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//拦截器要注册才可以生效，注册器要实现WebMvcConfigurer
@Component
public class WebConfig implements WebMvcConfigurer {
//    @Autowired
//    private TokenInterceptor tokenInterceptor;
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(tokenInterceptor)
                    //这个是拦截所有请求
//                .addPathPatterns("/**")
                    //这个是把login请求排除在外，就是不拦截login的请求
//                .excludePathPatterns("/login");
//    }
}
